/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainGUI.java
 *
 * Created on 24 Jul 12, 21:40:56
 */
package gui;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author private
 */
public class MainGUI extends javax.swing.JFrame {

    EntityManager em;
    EntityManagerFactory emf;
    
    public void init(){
        emf = Persistence.createEntityManagerFactory("PenggajianPU");
        em = emf.createEntityManager();
        this.setLocationRelativeTo(null);
    }
    
    /** Creates new form MainGUI */
    public MainGUI() {
        initComponents();
        this.init();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panel = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        tambahGolongan_menu = new javax.swing.JMenuItem();
        ubahgolongan_menu = new javax.swing.JMenuItem();
        hapusgolongan_menu = new javax.swing.JMenuItem();
        lihatgolongan_menu = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        tambahkaryawan_menu = new javax.swing.JMenuItem();
        ubahkaryawan_menu = new javax.swing.JMenuItem();
        hapuskaryawanmenu = new javax.swing.JMenuItem();
        lihatkaryawan_menu = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        tambahgaji_menu = new javax.swing.JMenuItem();
        ubahgaji_menu = new javax.swing.JMenuItem();
        hapusgaji_menu = new javax.swing.JMenuItem();
        lihatgaji_menu = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setResizable(false);

        jMenu1.setText("Golongan");

        tambahGolongan_menu.setText("Tambah Golongan");
        tambahGolongan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahGolongan_menuActionPerformed(evt);
            }
        });
        jMenu1.add(tambahGolongan_menu);

        ubahgolongan_menu.setText("Ubah Golongan");
        ubahgolongan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ubahgolongan_menuActionPerformed(evt);
            }
        });
        jMenu1.add(ubahgolongan_menu);

        hapusgolongan_menu.setText("Hapus Golongan");
        hapusgolongan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hapusgolongan_menuActionPerformed(evt);
            }
        });
        jMenu1.add(hapusgolongan_menu);

        lihatgolongan_menu.setText("Lihat Golongan");
        lihatgolongan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatgolongan_menuActionPerformed(evt);
            }
        });
        jMenu1.add(lihatgolongan_menu);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Karyawan");

        tambahkaryawan_menu.setText("Tambah Karyawan");
        tambahkaryawan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahkaryawan_menuActionPerformed(evt);
            }
        });
        jMenu2.add(tambahkaryawan_menu);

        ubahkaryawan_menu.setText("Ubah Karyawan");
        ubahkaryawan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ubahkaryawan_menuActionPerformed(evt);
            }
        });
        jMenu2.add(ubahkaryawan_menu);

        hapuskaryawanmenu.setText("Hapus Karyawan");
        hapuskaryawanmenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hapuskaryawanmenuActionPerformed(evt);
            }
        });
        jMenu2.add(hapuskaryawanmenu);

        lihatkaryawan_menu.setText("Lihat Karyawan");
        lihatkaryawan_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatkaryawan_menuActionPerformed(evt);
            }
        });
        jMenu2.add(lihatkaryawan_menu);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Gaji");

        tambahgaji_menu.setText("Tambah Gaji");
        tambahgaji_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahgaji_menuActionPerformed(evt);
            }
        });
        jMenu3.add(tambahgaji_menu);

        ubahgaji_menu.setText("Ubah Gaji");
        ubahgaji_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ubahgaji_menuActionPerformed(evt);
            }
        });
        jMenu3.add(ubahgaji_menu);

        hapusgaji_menu.setText("Hapus Gaji");
        hapusgaji_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hapusgaji_menuActionPerformed(evt);
            }
        });
        jMenu3.add(hapusgaji_menu);

        lihatgaji_menu.setText("Lihat Gaji");
        lihatgaji_menu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatgaji_menuActionPerformed(evt);
            }
        });
        jMenu3.add(lihatgaji_menu);

        jMenuBar1.add(jMenu3);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, 882, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panel, javax.swing.GroupLayout.DEFAULT_SIZE, 485, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tambahGolongan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahGolongan_menuActionPerformed
        // TODO add your handling code here:
        TambahGolonganGUI gui = new TambahGolonganGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_tambahGolongan_menuActionPerformed

    private void ubahgolongan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ubahgolongan_menuActionPerformed
        // TODO add your handling code here:
        UbahGolonganGUI gui = new UbahGolonganGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_ubahgolongan_menuActionPerformed

    private void hapusgolongan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hapusgolongan_menuActionPerformed
        // TODO add your handling code here:
        HapusGolonganGUI gui = new HapusGolonganGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_hapusgolongan_menuActionPerformed

    private void lihatgolongan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatgolongan_menuActionPerformed
        // TODO add your handling code here:
        LihatGolonganGUI gui = new LihatGolonganGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_lihatgolongan_menuActionPerformed

    private void tambahkaryawan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahkaryawan_menuActionPerformed
        // TODO add your handling code here:
        TambahKaryawanGUI gui = new TambahKaryawanGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_tambahkaryawan_menuActionPerformed

    private void tambahgaji_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahgaji_menuActionPerformed
        // TODO add your handling code here:
        TambahGajiGUI gui = new TambahGajiGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_tambahgaji_menuActionPerformed

    private void ubahkaryawan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ubahkaryawan_menuActionPerformed
        // TODO add your handling code here:
        UbahKaryawanGUI gui = new UbahKaryawanGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_ubahkaryawan_menuActionPerformed

    private void hapuskaryawanmenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hapuskaryawanmenuActionPerformed
        // TODO add your handling code here:
        HapusKaryawanGUI gui = new HapusKaryawanGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_hapuskaryawanmenuActionPerformed

    private void lihatkaryawan_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatkaryawan_menuActionPerformed
        // TODO add your handling code here
        LihatKaryawanGUI gui = new LihatKaryawanGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_lihatkaryawan_menuActionPerformed

    private void hapusgaji_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hapusgaji_menuActionPerformed
        // TODO add your handling code here:
        HapusGajiGUI gui = new HapusGajiGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_hapusgaji_menuActionPerformed

    private void lihatgaji_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatgaji_menuActionPerformed
        // TODO add your handling code here:
        LihatGajiGUI gui = new LihatGajiGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_lihatgaji_menuActionPerformed

    private void ubahgaji_menuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ubahgaji_menuActionPerformed
        // TODO add your handling code here:
        UbahGajiGUI gui = new UbahGajiGUI(em);
        gui.setVisible(true);
        panel.add(gui);
    }//GEN-LAST:event_ubahgaji_menuActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MainGUI().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenuItem hapusgaji_menu;
    private javax.swing.JMenuItem hapusgolongan_menu;
    private javax.swing.JMenuItem hapuskaryawanmenu;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem lihatgaji_menu;
    private javax.swing.JMenuItem lihatgolongan_menu;
    private javax.swing.JMenuItem lihatkaryawan_menu;
    private javax.swing.JDesktopPane panel;
    private javax.swing.JMenuItem tambahGolongan_menu;
    private javax.swing.JMenuItem tambahgaji_menu;
    private javax.swing.JMenuItem tambahkaryawan_menu;
    private javax.swing.JMenuItem ubahgaji_menu;
    private javax.swing.JMenuItem ubahgolongan_menu;
    private javax.swing.JMenuItem ubahkaryawan_menu;
    // End of variables declaration//GEN-END:variables
}
